﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chart
{
	public class ChartBase
	{
		public List<TimeSeries> Data;
		public ChartBase()
		{
			Data = new List<TimeSeries>();
		}
		public int CreateData()
		{
			Data.Add(new TimeSeries());
			return Data.Count - 1;
		}
	}

	public class TimeChart : ChartBase
	{
		public DateTime MinTime
		{
			get
			{
				long res = Data[0].Values[0].Key.ToBinary();
				Data.ForEach(D => D.Values.ForEach(V => res = res > V.Key.ToBinary() ? V.Key.ToBinary() : res));
				return DateTime.FromBinary(res);
			}
		}
		public DateTime MaxTime
		{
			get
			{
				long res = Data[0].Values[0].Key.ToBinary();
				Data.ForEach(D => D.Values.ForEach(V => res = res < V.Key.ToBinary() ? V.Key.ToBinary() : res));
				return DateTime.FromBinary(res);
			}
		}
	}
}